tools/hv: Fix fortify format warning
authorBen Hutchings <ben@decadent.org.uk>
Fri, 25 Sep 2015 19:28:10 +0000 (20:28 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 2 May 2017 15:21:44 +0000 (15:21 +0000)
commit08b6adeacc93c72a8287fca9a72b86d28b9143d1
treef2c647b26f2d828216ab8098734f97ac53d469d5
parente15391e1733b102468b1b77d65c945136d6042f6
tools/hv: Fix fortify format warning

With fortify enabled, gcc warns:

tools/hv/hv_kvp_daemon.c:705:2: error: format not a string literal and no format arguments [-Werror=format-security]
  snprintf(dev_id, sizeof(dev_id), kvp_net_dir);
  ^

kvp_net_dir is a pointer to a string literal, but lacks const
qualification.  As it is never modified, it should be a const
array rather than a pointer.

Also, while snprintf() has a bounds check, the following strcat()s
do not.  Combine them into a single snprintf().

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic bugfix/x86
Gbp-Pq: Name tools-hv-fix-fortify-format-warning.patch
tools/hv/hv_kvp_daemon.c